ext_int="eth10"
int_int="eth9"

fw_ext_addr="192.168.0.13"
fw_DMZ_addr="192.168.1.1"
client_addr="192.168.1.5"

#flush rules 
iptables -F
iptables -t nat -F
# echo 1 > /proc/sys/net/ipv4/ip_forward
# SSH: need to make sure that the domain for the target machine (firewall) is not cached in the clients host file.
#      To remove entries from ssh host file type ssh-keygen -R [ip]
##########################################################################
############## DO NOT ALTER ANYTHING BELOW THIS LINE!!! ##################
##########################################################################
#need to add route to the client machine. this will allow static ip to be assigned to some sort of gateway. 
#example: 
#
# ifconfig eth9 192.168.1.5 up
# route add default gw 192.168.1.1
#
#

#FORWARDING RULES
# postrouting == out
iptables -A POSTROUTING -t nat -o ${ext_int} -j SNAT --to-source ${fw_ext_addr}

#related forward rules
iptables -A FORWARD -o ${int_int} -j ACCEPT #-m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -o ${ext_int} -j ACCEPT #-m state --state NEW,ESTABLISHED,RELATED -j ACCEPT

# prerouting == in
iptables -A PREROUTING -t nat -i ${ext_int} -d ${fw_ext_addr} -j DNAT --to-destination ${client_addr}

#related forward rules
iptables -A FORWARD -i ${ext_int} -o ${int_int} -d ${client_addr} -j ACCEPT #-m state --state NEW -j ACCEPT
iptables -A FORWARD -i ${int_int} -o ${ext_int} -j ACCEPT #-m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i ${ext_int} -o ${int_int} -j ACCEPT #-m state --state ESTABLISHED,RELATED -j ACCEPT
